﻿#ifndef WIDGET_H
#define WIDGET_H

#include <QWidget>
#include <QDateTime>
#include <QMessageBox>
#include <QDesktopServices>
#include <QUrl>

#include "../LanMengBaZi/plug/fz.h"
#include "Gua.h"
#include "Save.h"
#include "view.h"

#include "../../h_cpp/randomNumber/randomNumber.h"
#include "../../h_cpp/verification/verification.h"

#ifdef Q_OS_ANDROID
#include "../Perpetual_calendar/LG.h"
#else
#include "../LanMengBaZi/plug/G2L.h"
#endif

namespace Ui {
class Widget;
}

class Widget : public QWidget
{
    Q_OBJECT

public:
    explicit Widget(QWidget *parent = Q_NULLPTR);
    ~Widget();

private:
    void paintEvent(QPaintEvent *event);
    
    void setAndroidLayout();
    void setEna(int n);
    
    void getDateTime();
    bool isTimeTrue();
    void init8Gua(const int index, bool &three, bool &two, bool &one);
    int getChNum(const QString str);
    
    void showGua();
    
private slots:
    void on_pushButton_now_clicked();
    void on_pushButton_star_clicked(); 
    
    void on_radioButton_Date_toggled(bool checked);
    void on_radioButton_srand_toggled(bool checked);
    void on_radioButton_Nums_toggled(bool checked);
    void on_radioButton_chiness_toggled(bool checked);

    void on_pushButton_about_clicked();
    void on_pushButton_save_clicked();
    void on_pushButton_view_clicked();


private:
    Ui::Widget *ui;

    bool lsGua[5][6];
    int num[3];    //本卦上下动
    
    //农历年月日及四柱序号
    int y, m, d;
    bool l;
    Enum_JiaZi f1, f2, f3, f4;

    //
    Save *pSave;
};

#endif // WIDGET_H
